<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Facades\Services\OrderService;
use ValiDate;
use App\Models\Order;

class OrderController extends Controller
{
    public function update(Request $request){
    	$rules = [
    		'id' => 'required|exists:orders,id',
    		'status' => 'required|in:'.implode(',',array_keys(Order::$STATUS))
    	];

    	ValiDate::valiDate($request,$rules);

    	$data=$request->all();

    	OrderService::updateStatus($data);

    	return formatJsonResponse();
    }
}
